Conversation
|
Before you submit for review:
If you did not complete any of these, then please explain below. |
r-devulap
left a comment
There was a problem hiding this comment.
This seems simple enough as a first step to prgress to running a a larger than memory dataset.
|
@ashkrisk you might want to rebase this to main |
257d43e to
d7c6b4f
Compare
d7c6b4f to
91aa5fb
Compare
|
I think the code looks fine but it feels like we're losing some flexibility in swapping out the Supplier function for the new DataSetFiles class. Would it not be possible to have DataSetFiles implement Supplier to achieve the same thing? |
The goal is to be able to use the same If I agree there are trade-offs associated with this. As I mentioned in the PR description there are alternatives that retain both kinds of flexibility, but I believe such a design is not worth the extra complexity at this point in time (and can always be added later if we really need it). |
|
@MarkWolters looking at the version of the |
|
Yeah, I see where you're going with it and I think it's a worthwhile effort, I just don't like how it's locked into Fvec/Ivec as the data format. I think it would be fairly cheap and easy to implement DataSetFiles as an interface that defines |
Make it so that the `DataSetLoader` is no longer responsible for deciding how to make a dataset's files available to the application. It remains responsible solely for resolving a dataset's files, which includes fetching them from a remote if required. To faciliate this, the `DataSetInfo` object now knows about the underlying files which make up a dataset and is free to provide methods which allow the caller to access the dataset in a format of their choosing. In particular, this makes it possible to add methods to `DataSetInfo` which allow for accessing datasets without loading them completely into memory. Summary of changes: - Introduces the `DataSetFiles` class for wrapping the base/query/gt paths of a dataset. - `DataSetInfo` no longer accepts a `Supplier<Dataset>`, instead accepting a `DataSetFiles` object. - `DataSetInfo` is responsible for converting `DataSetFiles` to an in-memory `DataSet` or other future formats. Possible alternatives: - Introduce an additional abstraction layer responsible for converting `DataSetFiles` to a `DataSet` or similar instead of passing the responsiblity onto `DataSetInfo`. This increases complextiy without much immediate benefit, so this is left to future patches if and when it becomes necessary (if we start supporting HDF5 again, for example).
91aa5fb to
f91e594
Compare
|
It's not possible to implement The change I've just pushed preserves generality by going in a slightly different direction - @MarkWolters what do you think? |
|
I like that approach, thanks for being responsive and flexible! |
jshook
left a comment
There was a problem hiding this comment.
I think we need to hold off on this one for a bit. Please do not merge it until I've had a chance to work through it.
| /// This method is thread-safe: concurrent callers will block until the first load | ||
| /// completes, after which all callers share the same cached instance. | ||
| /// | ||
| /// @return the ready-to-use {@link DataSet} |
There was a problem hiding this comment.
Datasets should never be scrubbed online. Is this comment out of date?
There was a problem hiding this comment.
No, the comment is still accurate, and preserves the existing behavior. DataSets with the LEGACY_SCRUB config continue to be scrubbed on load (by processDataSet)
|
It seems to me that this PR is trying to solve a problem which has already been solved. I'll explain below: DataSet is already abstract before this. This is intentional, as this subsumes the modal behavior of how a dataset should be loaded. There are different implementations of DataSet to illustrate this. DataSetProperties captures the ancillary/metadata elements in a contract type as well. This is how we provide the information about a dataset without having to load it or bind the metadata access to the dataset access. This what allows us to know about a dataset without having to have a dataset. DataSetInfo is intentionally not a contract type, because it serves multiple purposes:
As such, making DataSetInfo into a contract type was only forced in the changes in this PR when the interior dataset type for a dataset was changed to a concrete type in 290f698 So, practically speaking, and with specific design support, the act of resolving and loading datasets was already provided for with appropriate contract types, and with these changes, [EDIT...] |
MarkWolters
left a comment
There was a problem hiding this comment.
Putting approval on hold so we can have a group discussion on the direction we want to go here
|
@jshook I think there's a disconnect between your understanding of the purpose of this PR and my understanding. I suspect the breakup of this change into a set of four stacked PRs is partially to blame. I'll try to explain below. First let me clarify some definitions:
Here is how they map to our existing API: // Step 1: Resolve the dataset, throw if not available
DataSetInfo dsInfo = DataSets.loadDataSet("cohere-english-v3-100k").orElseThrow();
// Step 2: Load the DataSet
DataSet ds = dsInfo.getDataSet();However, to create a The goal of this PR series is to allow DataSet inMemDs = dsInfo.getDataSet();
// or
DataSet mmapDs = dsInfo.getMappedDataSet();Now, we can debate about the best way to achieve this, but I hope we can agree at the very least that the current interface does NOT solve this problem. Please do let me know if there's a subtlety here that I've missed. |
Make it so that the
DataSetLoaderis no longer responsible for deciding how to make a dataset's files available to the application. It remains responsible solely for resolving a dataset's files, which includes fetching them from a remote if required.To faciliate this, the
DataSetInfoobject now knows about the underlying files which make up a dataset and is free to provide methods which allow the caller to access the dataset in a format of their choosing. In particular, this makes it possible to add methods toDataSetInfowhich allow for accessing datasets without loading them completely into memory.Summary of changes:
DataSetFilesclass for wrapping the base/query/gt paths of a dataset.DataSetInfono longer accepts aSupplier<Dataset>, instead accepting aDataSetFilesobject.DataSetInfois responsible for convertingDataSetFilesto an in-memoryDataSetor other future formats.Possible alternatives:
DataSetFilesto aDataSetor similar instead of passing the responsibility ontoDataSetInfo. This increases complexity without much immediate benefit, so this is left to future patches if and when it becomes necessary (if we start supporting HDF5 again, for example).